package com.sgcc.activiti.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.sgcc.common.log.annotation.Log;
import com.sgcc.common.log.enums.BusinessType;
import com.sgcc.common.security.annotation.PreAuthorize;
import com.sgcc.activiti.domain.OSupplierEvaluation;
import com.sgcc.activiti.service.IOSupplierEvaluationService;
import com.sgcc.common.core.web.controller.BaseController;
import com.sgcc.common.core.web.domain.AjaxResult;
import com.sgcc.common.core.utils.poi.ExcelUtil;
import com.sgcc.common.core.web.page.TableDataInfo;

/**
 * OSupplierEvaluationController
 * 
 * @author sgcc
 * @date 2021-04-09
 */
@RestController
@RequestMapping("/OSupplierEvaluation")
public class OSupplierEvaluationController extends BaseController
{
    @Autowired
    private IOSupplierEvaluationService oSupplierEvaluationService;

    /**
     * 查询OSupplierEvaluation列表
     */
    //@PreAuthorize(hasPermi = "activiti:OSupplierEvaluation:list")
    @GetMapping("/list")
    public TableDataInfo list(OSupplierEvaluation oSupplierEvaluation)
    {
        startPage();
        List<OSupplierEvaluation> list = oSupplierEvaluationService.selectOSupplierEvaluationList(oSupplierEvaluation);
        return getDataTable(list);
    }

    /**
     * 导出OSupplierEvaluation列表
     */
    //@PreAuthorize(hasPermi = "activiti:OSupplierEvaluation:export")
    @Log(title = "OSupplierEvaluation", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, OSupplierEvaluation oSupplierEvaluation) throws IOException
    {
        List<OSupplierEvaluation> list = oSupplierEvaluationService.selectOSupplierEvaluationList(oSupplierEvaluation);
        ExcelUtil<OSupplierEvaluation> util = new ExcelUtil<OSupplierEvaluation>(OSupplierEvaluation.class);
        util.exportExcel(response, list, "OSupplierEvaluation");
    }

    /**
     * 获取OSupplierEvaluation详细信息
     */
    //@PreAuthorize(hasPermi = "activiti:OSupplierEvaluation:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return AjaxResult.success(oSupplierEvaluationService.selectOSupplierEvaluationById(id));
    }

    /**
     * 新增OSupplierEvaluation
     */
    //@PreAuthorize(hasPermi = "activiti:OSupplierEvaluation:add")
    @Log(title = "OSupplierEvaluation", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody OSupplierEvaluation oSupplierEvaluation)
    {
        return toAjax(oSupplierEvaluationService.insertOSupplierEvaluation(oSupplierEvaluation));
    }

    /**
     * 修改OSupplierEvaluation
     */
    //@PreAuthorize(hasPermi = "activiti:OSupplierEvaluation:edit")
    @Log(title = "OSupplierEvaluation", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody OSupplierEvaluation oSupplierEvaluation)
    {
        return toAjax(oSupplierEvaluationService.updateOSupplierEvaluation(oSupplierEvaluation));
    }

    /**
     * 删除OSupplierEvaluation
     */
    //@PreAuthorize(hasPermi = "activiti:OSupplierEvaluation:remove")
    @Log(title = "OSupplierEvaluation", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(oSupplierEvaluationService.deleteOSupplierEvaluationByIds(ids));
    }
}
